//
//  BLMeetStatusView.m
//  Byelone
//
//  Created by 乔小乔 on 2021/2/8.
//

#import "BLMeetStatusView.h"
@interface BLMeetStatusView ()
@property (nonatomic, strong) UIView *viewPoint;
@property (nonatomic, strong) NSMutableArray *arrayView;
@end
@implementation BLMeetStatusView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
- (void)createUI{
    self.arrayView = [NSMutableArray new];
    [self addSubview:self.viewPoint];
    CGFloat y = 17;
    for (int i= 0; i<4; i++) {
        UIView *view = [self getViewLine:y];
        [self.arrayView addObject:view];
        [self addSubview:view];
        y=y+5+4.5;
    }
}

- (void)setColorStr:(NSString *)colorStr{
    if (colorStr) {
        _colorStr = colorStr;
        self.viewPoint.layer.borderColor = [UIColor chColorWithHexString:colorStr].CGColor;
        for (UIView *view in self.arrayView) {
            view.backgroundColor = [UIColor chColorWithHexString:colorStr];
        }
    }
}

- (UIView *)viewPoint{
    if (!_viewPoint) {
        _viewPoint = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 14, 14)];
        _viewPoint.layer.cornerRadius = 7;
        _viewPoint.layer.masksToBounds = YES;
        _viewPoint.layer.borderWidth = 3;
        _viewPoint.layer.borderColor = [UIColor chColorWithHexString:self.colorStr?:@"#CBCBCB"].CGColor;
    }
    return _viewPoint;
}

- (UIView *)getViewLine:(CGFloat)y{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(5.75, y, 2.5, 5)];
    view.layer.cornerRadius = 1.3;
    view.layer.masksToBounds = YES;
    view.backgroundColor = [UIColor chColorWithHexString:self.colorStr?:@"#CBCBCB"];
    return view;
}
@end
